#coding=utf-8 
''' 
Created on 2010-3-27 
@author: sillycat 
''' 
import sys,os,time
import wx 
class App(wx.App): 
    framex=None
    """
    def __init__(self, redirect=True, filename=None): 
        print "App __init__" 
        wx.App.__init__(self, redirect, filename)
    """    
    def OnInit(self): 
        self.framex = wx.Frame(parent=None, title='Barexxoo',size=(200,200) ,pos=wx.Point(200,400)) 

        panel = wx.Panel(self.framex) #创建画板 
        button = wx.Button(panel, label="Close", pos=(1, 1),  size=(50, 50)) #将按钮添加到画板 
        
        
        
        #绑定按钮的单击事件 
        #self.framex.Bind(wx.EVT_BUTTON, self.MeOnHid, button) #隐藏窗口
        
        self.framex.Bind(wx.EVT_BUTTON, self.MeOnClose, button) #关闭窗口

        
        #绑定窗口的关闭事件 
        self.framex.Bind(wx.EVT_CLOSE, self.MeOnCloseWindow) 



        self.buttonx = wx.Button(panel, label="Not Over", pos=(100, 15))
        
        self.framex.Bind(wx.EVT_BUTTON, self.MeOnX,self.buttonx)    #1 绑定按钮事件          
        
        #wx.ENTER_WINDOW和wx.LEAVE_WINDOW产生于当鼠标进入或离开一个窗口部件时      
        #self.framex.Bind(wx.ENTER_WINDOW,self.MeOnX,self.buttonx)     #2 绑定鼠标位于其上事件          
        #self.framex.button.Bind(wx.EVT_LEAVE_WINDOW,self.MeOnX,self.buttonx)     #3 绑定鼠标离开事件
        
        
        self.framex.Show() 
        return True 
        
    def MeOnX(self,event):
        pass
        self.buttonx.SetLabel("Over Me!")
        
        print "event"
        
    
    
    def MeOnHid(self,event):
        self.framex.Hide()  
        #print "self.framex.Hide"  


    def MeOnClose(self, event): 
        self.framex.Close(True) 
        #print "self.framex.MeOnClose"  
        
        
    def MeOnCloseWindow(self, event): 
        """ 最终的销毁 """
        self.framex.Destroy() 
        #print "MeOnCloseWindow"
        
    def OnExit(self): 
        """ 离开事件"""
        #print "OnExit"        
        #time.sleep(5);
            
        
        
        

app = App() 

app.MainLoop()




